package util;

import java.awt.event.KeyEvent;

public class Validaciones {

    public String soloLetras() {
        return "[a-zA-z]";
    }

    public String soloNumeros() {
        return "[\\d]";
    }

    public String validarCorreo() {
        return "[@{1}]";
    }

    public String validarUsuario() {
        return "[\\w]";
    }

    public void nameTextKeyTyped(final KeyEvent event) {
        boolean doBeep = true;
        final char c = event.getKeyChar();
        switch (c) {
            case KeyEvent.VK_BACK_SPACE:
            case KeyEvent.VK_DELETE:
            case KeyEvent.VK_SPACE:
                doBeep = false;
                break;
            default:
                doBeep = !Character.isAlphabetic(c);
            // no need to "break;": last branch of switch
        }
        event.consume();
    }
}